package kr.pe.johnkim.carrotpoint.mobile.service;

import kr.pe.johnkim.carrotpoint.mobile.dao.CarrotPointMerchantBankDao;
import kr.pe.johnkim.carrotpoint.mobile.domain.CarrotPointMerchantBank;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Carrot Point 가맹점 결제 은행 관련 service 클래스 이다.
 *
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 2. 6.
 */
@Service
public class CarrotPointMerchantBankServiceImpl implements CarrotPointMerchantBankService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(CarrotPointMerchantBankServiceImpl.class);

    @Autowired
    private CarrotPointMerchantBankDao carrotPointMerchantBankDao;

    /**
     * 가맹점 거래 은행을 등록 한다.
     *
     * @param carrotPointMerchantBank
     */
    @Override
    public void registerMerchantBank(CarrotPointMerchantBank carrotPointMerchantBank) {
        logger.info("registerMerchantBank");
        carrotPointMerchantBankDao.registerMerchantBank(carrotPointMerchantBank);
    }

    /**
     * 가맹점 거래 은행 목록을 가져 온다.
     *
     * @param carrotPointMerchantBank
     * @return
     */
    @Override
    public List<CarrotPointMerchantBank> getMerchantBankList(CarrotPointMerchantBank carrotPointMerchantBank) {
        logger.info("getMerchantBankList");
        return carrotPointMerchantBankDao.getMerchantBankList(carrotPointMerchantBank);
    }

    /**
     * 가맹점 거래 은행 정보를 가져 온다.
     *
     * @param carrotPointMerchantBank
     * @return
     */
    @Override
    public CarrotPointMerchantBank getMerchantBankInformation(CarrotPointMerchantBank carrotPointMerchantBank) {
        logger.info("getMerchantBankInformation");
        return carrotPointMerchantBankDao.getMerchantBankInformation(carrotPointMerchantBank);
    }

    /**
     * 가맹점 거래 은행 정보를 업데이트 한다.
     *
     * @param carrotPointMerchantBank
     */
    @Override
    public void updateMerchantBankInformation(CarrotPointMerchantBank carrotPointMerchantBank) {
        logger.info("updateMerchantBankInformation");
        carrotPointMerchantBankDao.updateMerchantBankInformation(carrotPointMerchantBank);
    }

    /**
     * 가맹점 거래 은행을 비활성화 한다.
     *
     * @param carrotPointMerchantBank
     */
    @Override
    public void updateDeactivateMerchantBank(CarrotPointMerchantBank carrotPointMerchantBank) {
        logger.info("updateDeactivateMerchantBank");
        carrotPointMerchantBankDao.updateDeactivateMerchantBank(carrotPointMerchantBank);
    }
}
